<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html>

<ui:composition template="../template.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui">
    <h:outputStylesheet name="css/bootstrap.css" />
    <ui:define name="content"> 
        <h:outputScript target="head">  $ = jQuery;</h:outputScript><!--ESTA LINA ES NECESARIA PARA QUE FUNCIONE JQUERY-->
        <script type="text/javascript">
            $(document).ready(function(){
                $(".ui-messages").fadeOut(3000);       
            });                
        </script>
        <div class="col-md-6">
            <h4>Priorizar &#211;rdenes de Trabajo </h4>
            <h:form id="formu">
                <div class="btn-group" >
                    <h:commandButton value="Procesar" class="btn btn-default" action="#{priorizarOrdenes.procesar()}" /> 
                    <h:commandButton value="Grabar" class="btn btn-default" action="#{priorizarOrdenes.grabar()}" /> 
                    <h:commandButton value="Imprimir" class="btn btn-default" action="#{priorizarOrdenes.imprimir()}" />                                 
                </div>
                
                <br/><p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" escape="false" /> <br/> 
               
                <h:panelGroup  rendered="#{priorizarOrdenes.listaOrdenes.size() > 0}" id="pnlnorows">    
                    <div class="panel panel-default">
                        <div class="table-responsive">
                            <p:dataTable id="tabla" var="p" value="#{priorizarOrdenes.listaOrdenes}" 
                                         paginator="true" rows="10"   paginatorPosition="bottom" 
                                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                                         rowsPerPageTemplate="5,10,15"   styleClass="table table-bordered table-striped table-condensed"
                                         style="font-size: 12px;" editable="true" editMode="cell" widgetVar="carsTable">  
                                <p:column headerText="N&#250;mero Orden"> 
                                    <h:outputText value="#{p.codigo}"/>
                                </p:column>
                                <p:column headerText="Cliente">    				
                                    <h:outputText value="#{p.descCliente}"/>   				
                                </p:column> 
                                <p:column headerText="Fecha">    				
                                    <h:outputText value="#{p.fechaRegistro}">
                                        <f:convertDateTime pattern="dd/MM/yyyy"/>
                                    </h:outputText>   				
                                </p:column> 
                                <p:column headerText="Prioridad" style="width:25%">                               
                                    <p:cellEditor>  
                                    <f:facet name="output"><h:outputText value="#{p.prioridad}"/></f:facet>  
                                     <f:facet name="input">  
                                         <h:selectOneMenu value="#{p.prioridad}" style="width:100%">
                                             <f:selectItems value="#{priorizarOrdenes.listaPrioridades}" var="a" itemLabel="#{a}" itemValue="#{a}"/>
                                         </h:selectOneMenu>
                                      </f:facet> 
                                    </p:cellEditor>  
                                </p:column> 
                            </p:dataTable> 
                        </div>
                    </div>
                </h:panelGroup>
            </h:form>
               
        </div>
    </ui:define>
</ui:composition>
